package edu.uwg.LewisWilliams.android.assignment1;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
/**
 * The ExtendedWelcomeActivity displays an uplifting message that changes
 * depending on previous input by the user.
 * 
 * @author Charles Williams
 * @version 2011.9.9
 */
public class ExtendedWelcomeActivity extends Activity {
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.extended_welcome);
        
        String messageToUser;
        //Checks to see if the information was passed from the previous activity
        if(this.getIntent().getExtras()!= null){
        	Bundle transferedData = this.getIntent().getExtras();
        	//Sets message to the happy message if the checkbox is checked
        	if(transferedData.getString("isChecked") != "null" && transferedData.getBoolean("isChecked")){
        		messageToUser = "I'm glad to hear that you are happy. I hope the picture below will further brighten your day.";
        	}
        	//Sets message to the cheer up message if the checkbox is not checked
        	else if(transferedData.getString("isChecked") != "null" && !transferedData.getBoolean("isChecked")){
        		messageToUser = "I'm sorry you are not feeling happy. Maybe the following picture will cheer you up.";
        	}
        	//Sets message to another message if a user reached the page my mystical means
        	else{
        		messageToUser = "I don't know how you got here, but I hope you're happy.";
        	}
        	//Finds and retrieves the text view for the message 
        	TextView positiveMessage = (TextView) this.findViewById(R.id.positiveMessageTextView);
        	//Sets the text view text to the message
        	positiveMessage.setText(messageToUser);
        } 
	}
}
